package io.renren.service.impl;

import io.renren.entity.RequestBean;
import io.renren.service.TircpService;

import javax.xml.ws.soap.MTOMFeature;

/**
 * 违法上传
 * @author liupengfei
 *
 */
public class UploadIllegalInfo {

	/**
	 * 违法上传
	 * @param req
	 * @return
	 * @throws Exception
	 */
	public static String send(RequestBean req) throws Exception {
		String xml = dataxml(req);
		System.out.println(xml);
		// 获得客户端上传实例
		TircpServiceImplService tircpServiceImplService = new TircpServiceImplService();
		TircpService tircpService = tircpServiceImplService.getTircpServiceImplPort(new MTOMFeature());
		// 调用上传接口
		return tircpService.writeObjectOut("71", "7C1F1D0A010701050815030105720A05010109040208676870446D72692E636E",
				"71C02", xml);
	}
	

	/**
	 * 客户端上上传程序 如果允许，对方可以直接用此例子进行上传。 Client
	 * 
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		RequestBean req = new RequestBean();
		req.setSBBH("1232");
		req.setHPZL("01");
		req.setHPHM("京Q1234");
		req.setWFXW("10180");
		req.setWFSJ("2017-05-03 15:25:00");
		req.setWFDD("790091020000");
		req.setWFDZ("丹阳东路至八一东路段-测试");
		req.setCDBH("1");
		req.setCLSD("");
		req.setCLXS("");
		req.setHPTZTP("");
		req.setJSRTZTP("");
		req.setZJWJ1("http://10.160.1.2:8080/zjwj.jpg");
		req.setZJWJ2("");
		req.setZJWJ3("");
		req.setZJWJ4("");
		req.setSPLJ("");
		req.setCJFS("1");
		req.setCJJG("302400000000");
		req.setSFQJ("00");
		req.setKSWFSJ("2016-02-25 15:25:00");
		req.setKSWFDD("");
		req.setKSWFDZ("");
		req.setCSBL("");
		req.setBZ("");
		req.setFXBH("10");
		req.setZPSL("1");
		req.setZPWJM("");
		String s = send(req);
		System.out.println(""+s);
	}

	
	public static String dataxml(RequestBean req) {
		String str = "";
		str += "<?xml version='1.0' encoding='UTF-8'?>";
		str += "<root><tvmr><version>1.0</version>";
		str += "<SBBH>" + req.getSBBH() + "</SBBH>";
		str += "<HPZL>" + req.getHPZL() + "</HPZL>";
		str += "<HPHM>" + req.getHPHM() + "</HPHM>";
		str += "<WFXW>" + req.getWFXW() + "</WFXW>";
		str += "<WFSJ>" + req.getWFSJ() + "</WFSJ>";
		str += "<WFDD>" + req.getWFDD() + "</WFDD>";
		str += "<WFDZ>" + req.getWFDZ() + "</WFDZ>";
		str += "<CDBH>" + req.getCDBH() + "</CDBH>";
		str += "<CLSD>" + req.getCLSD() + "</CLSD>";
		str += "<CLXS>" + req.getCLXS() + "</CLXS>";
		str += "<HPTZTP>" + req.getHPTZTP() + "</HPTZTP>";
		str += "<JSRTZTP>" + req.getJSRTZTP() + "</JSRTZTP>";
		str += "<ZJWJ1>" + req.getZJWJ1() + "</ZJWJ1>";
		str += "<ZJWJ2>" + req.getZJWJ2() + "</ZJWJ2>";
		str += "<ZJWJ3>" + req.getZJWJ3() + "</ZJWJ3>";
		str += "<ZJWJ4>" + req.getZJWJ4() + "</ZJWJ4>";
		str += "<SPLJ>" + req.getSPLJ() + "</SPLJ>";
		str += "<CJFS>" + req.getCJFS() + "</CJFS>";
		str += "<CJJG>" + req.getCJJG() + "</CJJG>";
		str += "<SFQJ>" + req.getSFQJ() + "</SFQJ>";
		str += "<KSWFSJ>" + req.getKSWFSJ() + "</KSWFSJ>";
		str += "<KSWFDD>" + req.getKSWFDD() + "</KSWFDD>";
		str += "<KSWFDZ>" + req.getKSWFDZ() + "</KSWFDZ>";
		str += "<QJJL>" + req.getQJJL() + "</QJJL>";
		str += "<QJYS>" + req.getQJYS() + "</QJYS>";
		str += "<CSBL>" + req.getCSBL() + "</CSBL>";
		str += "<BZ>" + req.getHPHM() + "</BZ>";
		str += "<FXBH>" + req.getFXBH() + "</FXBH>";
		str += "<ZPSL>" + req.getZPSL() + "</ZPSL>";
		str += "<ZPWJM>" + req.getZPWJM() + "</ZPWJM>";
		str += "<CJYH>" + req.getHPHM() + "</CJYH>";
		str += "</tvmr></root>";
		return str;
	}
	
}
